package com.beyond.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.beyond.entity.User;
import com.beyond.service.UserService;

@Controller("helloAction")
@Scope("prototype")
public class HelloAction extends BaseAction {
	private static final long serialVersionUID = 1L;
	
	@Autowired(required=true)
	private UserService userService;

	private User user;
	
	@Override
	public void destory() throws Exception {
		System.out.println(" HelloAction destory ");
	}

	@Override
	public void initAction() throws Exception {
		System.out.println(" HelloAction init ");
	}
	
	public String execute() throws Exception{
		user = userService.getUser(1);
		System.out.println(user);
		return SUCCESS;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
